﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using STMS.Models.DModels;

namespace STMS.DAL
{
    /// <summary>
    /// 用户登录
    /// </summary>
    public class UserDAL:BaseDAL<UserInfo>
    {

        public int LoginSystem(string username, string password)
        {
            string strWhere = "UserName=@userName and UserPwd=@userPwd and UserState=1" +
                " and IsDeleted=0";
            SqlParameter[] paras =
            {
                new SqlParameter("userName",username),
                new SqlParameter("userPwd",password)
            };
            UserInfo user = GetModel(strWhere, "UserId", paras);
            if(user != null)
            {
                return user.UserId;
            }
            else
            {
                return 0;
            }
        }
    }
}
